package solitaire.presentation;

import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.BoxLayout;
import javax.swing.JPanel;

import solitaire.InterfacesControle.ICColonne;
import solitaire.InterfacesPresentation.IPCarte;
import solitaire.InterfacesPresentation.IPColonne;
import solitaire.InterfacesPresentation.IPTas;
import solitaire.controle.CColonne;

public class PColonne extends JPanel implements IPColonne {

	private ICColonne controleur;
	private IPTas tasVisible;
	private IPTas tasCache;

	public PColonne(IPTas tasVisible,IPTas tasCache){
		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		add(tasCache.getJComponent());
		tasCache.setLayout(new OverlapLayout(new Point(0,5)));
		add(tasVisible.getJComponent());
		this.tasVisible=tasVisible;
		this.tasCache=tasCache;
		tasCache.getJComponent().addMouseListener(new MouseListener() {

			@Override
			public void mouseReleased(MouseEvent arg0) {
				// TODO Auto-generated method stub

			}

			@Override
			public void mousePressed(MouseEvent arg0) {
				// TODO Auto-generated method stub

			}

			@Override
			public void mouseExited(MouseEvent arg0) {
				// TODO Auto-generated method stub

			}

			@Override
			public void mouseEntered(MouseEvent arg0) {
				// TODO Auto-generated method stub

			}

			@Override
			public void mouseClicked(MouseEvent arg0) {
				//Ne passe jamais dedans surement a cause du DND
				controleur.clicTasCache();

			}
		});

	}

	@Override
	public void setControleur(CColonne cColonne) {
		controleur=cColonne;
	}

	public JPanel getJComponent(){
		return this;
	}

	@Override
	public void empiler(IPCarte carte) {

		tasVisible.getJComponent().add(carte.getJPanel());

	}

	@Override
	public void depiler() {
		// TODO Auto-generated method stub
	}
	
	public ICColonne getControleur() {
		return controleur;
	}


}
